#ifndef  _M_PLAYER_H_
#define  _M_PLAYER_H_
#include <windows.h>
#include  <vfw.h>
#pragma comment(lib, "vfw32.lib")

class Mp3Player
{
public:
	Mp3Player(HWND hParent):m_hWnd(0)
	{
		m_hWnd=MCIWndCreate(hParent, NULL, MCIWNDF_NOMENU|MCIWNDF_NOERRORDLG|MCIWNDF_NOTIFYMODE|MCIWNDF_SHOWALL, NULL);
	}
	~Mp3Player(){
		if(m_hWnd) MCIWndClose(m_hWnd);
	}
	int Open(TCHAR* filename)
	{
		int rt=0;
		if(m_hWnd) 
			rt = (MCIWndOpen(m_hWnd, filename, NULL)==0);
		return rt;
	}

	int Play()
	{
		int rt=0;
		if(m_hWnd) rt=(MCIWndPlay(m_hWnd)==0);
		return rt;
	}

	int Stop()
	{
		int rt=0;
		if(m_hWnd) MCIWndStop(m_hWnd);
		return rt;
	}
private:
	HWND m_hWnd;
};

#endif//_M_PLAYER_H_ 